/**
 * 
 */
package com.dalonedrow.engine.ui.base;

import com.dalonedrow.engine.sprite.base.SimpleDimension;
import com.dalonedrow.engine.sprite.base.SimpleVector2;
import com.dalonedrow.engine.sprite.base.SimpleVector3;
import com.dalonedrow.engine.ui.base.border.GuiBorder;

/**
 * The UI component interface.
 * @author DaLoneDrau
 */
public interface GuiComponent {
	/**
	 * Sets the active image's reference id.
	 * @param refId the inactive image's reference id
	 */
	void setActiveImage(int refId);
	/**
	 * Sets the inactive image's reference id.
	 * @param refId the inactive image's reference id
	 */
	void setInactiveImage(int refId);
	/**
	 * if the {@link GuiComponent} has highlight/select borders, those borders
	 * are positioned inside the standard border.
	 */
	int	BORDER_FIRST	= 1;
	/**
	 * when the landscape alignment is chosen, items are displayed side-by-side,
	 * bottom-aligned.
	 */
	int	BOTTOM			= 0;
	/**
	 * when the landscape alignment is chosen, items are displayed side-by-side,
	 * center-aligned. <br>
	 * <br>
	 * when the portait alignment is used, items are displayed on top of each
	 * other, center-aligned.
	 */
	int	CENTER			= 1;
	/**
	 * if the {@link GuiComponent} has highlight/select borders, those borders
	 * are positioned outside the standard border.
	 */
	int	HIGHLIGHT_FIRST	= 0;
	/**
	 * when the portrait alignment is chosen, items are displayed on top of each
	 * other, left-aligned.
	 */
	int	LEFT			= 3;
	/**
	 * when the portrait alignment is chosen, items are displayed on top of each
	 * other, right-aligned.
	 */
	int	RIGHT			= 4;
	/** content is the first tab. */
	int	TAB_FIRST		= 0;
	/** content is the last tab. */
	int	TAB_LAST		= 2;
	/** content is a middle tab. */
	int	TAB_MIDDLE		= 1;
	/** text is spread out evenly across the component. */
	int	TEXT_JUSTIFY	= 5;
	/**
	 * when the landscape alignment is chosen, items are displayed side-by-side,
	 * top-aligned.
	 */
	int	TOP				= 2;
	/**
	 * Checks whether this component "contains" the specified SimpleVector2, where the
	 * SimpleVector2's <i>x</i> and <i>y</i> coordinates are defined to be relative to
	 * the coordinate system of this component.
	 * @param x the <i>x</i> coordinate of the SimpleVector2
	 * @param y the <i>y</i> coordinate of the SimpleVector2
	 * @return true if the {@link GuiComponent} "contains" the SimpleVector2; false
	 *         otherwise
	 */
	boolean contains(double x, double y);
	/**
	 * Checks whether this component "contains" the specified SimpleVector2, where the
	 * SimpleVector2's <i>x</i> and <i>y</i> coordinates are defined to be relative to
	 * the coordinate system of this component.
	 * @param x the <i>x</i> coordinate of the SimpleVector2
	 * @param y the <i>y</i> coordinate of the SimpleVector2
	 * @return true if the {@link GuiComponent} "contains" the SimpleVector2; false
	 *         otherwise
	 */
	boolean contains(int x, int y);
	/**
	 * Checks whether this component "contains" the specified SimpleVector2, where the
	 * SimpleVector2's <i>x</i> and <i>y</i> coordinates are defined to be relative to
	 * the coordinate system of this component.
	 * @param pt the {@link SimpleVector2}
	 * @return true if the {@link GuiComponent} "contains" the {@link SimpleVector2};
	 *         false otherwise
	 */
	boolean contains(SimpleVector2 pt);
	/**
	 * Gets the {@link GuiBorder} around this <code>GuiComponent</code>.
	 * @return {@link GuiBorder}
	 */
	GuiBorder getBorder();
	/**
	 * Gets the <code>GuiComponent</code>'s id.
	 * @return int
	 */
	int getId();
	/**
	 * Gets the <code>GuiComponent</code>'s {@link Insets}.
	 * @return {@link Insets}
	 */
	SimpleInsets getInsets();
	/**
	 * Gets the <code>GuiComponent</code>'s position on screen.
	 * @return {@link SimpleVector3}
	 */
	SimpleVector3 getPosition();
	/**
	 * Gets the {@link GuiComponent}'s preferred size.
	 * @return {@link SimpleDimension}
	 */
	SimpleDimension getPreferredSize();
	/**
	 * Gets the {@link GuiComponent}'s preferred size when determining the
	 * tooltip location.
	 * @return {@link SimpleDimension}
	 */
	SimpleDimension getPreferredSizeWhenDisplayingTooltip();
	/**
	 * Gets the <code>GuiComponent</code>'s position on screen.
	 * @return {@link SimpleVector3}
	 */
	SimpleVector3 getPreferredTooltipPosition();
	/**
	 * Gets the tooltip displayed.
	 * @return {@link String}
	 */
	String getTooltipText();
	/**
	 * Gets the View associated with this <code>GuiComponent</code>.
	 * @return {@link View}
	 */
	View getView();
	/**
	 * Determines if the {@link GuiComponent} has tooltips to display.
	 * @return true if the item has tooltips; false otherwise
	 */
	boolean hasTooltipText();
	/**
	 * Determines if the tooltip timer has started.
	 * @return true if the timer has started; false otherwise
	 */
	boolean hasTooltipTimerStarted();
	/**
	 * Determines whether the {@link GuiComponent} is active.
	 * @return true if the {@link GuiComponent} is active; false otherwise
	 */
	boolean isActive();
	/**
	 * Gets the debugging output flag.
	 * @return <code>boolean</code>
	 */
	boolean isDebug();
	/**
	 * Determines if the {@link GuiComponent} is visible.
	 * @return true if the {@link GuiComponent} can be seen; false otherwise
	 */
	boolean isVisible();
	/**
	 * Prepares the {@link View} for the rendering loop.
	 * @throws Exception if there is an error
	 */
	void prepareForRendering() throws Exception;
	/**
	 * Sets the <code>GuiComponent</code> active or inactive.
	 * @param isActive if true, the <code>GuiComponent</code> is activated;
	 *        otherwise the <code>GuiComponent</code> is considered inactive
	 */
	void setActive(boolean isActive);
	/**
	 * Sets the {@link GuiBorder} around this <code>GuiComponent</code>.
	 * @param newBorder the {@link GuiBorder}
	 */
	void setBorder(GuiBorder newBorder);
	/**
	 * Sets the <code>GuiComponent</code>'s {@link Insets}.
	 * @param newInsets the insets
	 */
	void setInsets(SimpleInsets newInsets);
	/**
	 * Sets the <code>GuiComponent</code>'s {@link Insets}.
	 * @param newInsets the insets
	 */
	void setInsets(int... newInsets);
	/**
	 * Sets the <code>GuiComponent</code>'s {@link Insets}.
	 * @param top the inset from the top
	 * @param left the inset from the left
	 * @param bottom the inset from the bottom
	 * @param right the inset from the right
	 */
	void setInsets(int top, int left, int bottom, int right);
	/**
	 * Sets the <code>GuiComponent</code>'s position on screen.
	 * @param x the x-position
	 * @param y the y-position
	 * @param z the z-position
	 */
	void setPosition(double x, double y, double z);
	/**
	 * Sets the {@link GuiComponent}'s preferred size.
	 * @param width the preferred width
	 * @param height the preferred height
	 */
	void setPreferredSize(int width, int height);
	/**
	 * Sets the tooltip displayed.
	 * @param newText the tooltip text
	 */
	void setTooltipText(float newText);
	/**
	 * Sets the tooltip displayed.
	 * @param newText the tooltip text
	 */
	void setTooltipText(int newText);
	/**
	 * Sets the tooltip displayed.
	 * @param newText the tooltip text
	 */
	void setTooltipText(String newText);
	/**
	 * Sets the {@link View} displaying this <code>GuiComponent</code>.
	 * @param newView the {@link View}
	 */
	void setView(View newView);
	/**
	 * Sets the flag indicating whether the <code>GuiComponent</code> is 
	 * visible.
	 * @param flag the flag
	 */
	void setVisible(boolean flag);
	/**
	 * Starts the tooltip timer.
	 * @param time the time in nanoseconds
	 */
	void startTooltipTimer(long time);
	/** Stops the tooltip timer. */
	void stopTooltipTimer();
	/**
	 * Updates an already started tooltip timer.
	 * @param time the time in nanoseconds
	 */
	void updateTooltipTimer(long time);
}
